package com.sh.mytool.cv.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.sh.common.properties.PropertiesUtils;

@Controller
public class IndexController {

    @RequestMapping(value = "/index", method = RequestMethod.GET)
    public String index(HttpServletRequest request, HttpSession session) {
        String imageroot = PropertiesUtils.getValueByResourceBundle("project", "image.root");
        String videoroot = PropertiesUtils.getValueByResourceBundle("project", "video.root");
        String imagecoverroot = PropertiesUtils.getValueByResourceBundle("project", "imagecover.root");
        String power = "{hidden: true}";
        if(session.getAttribute("login") != null){
            power = "{hidden: false}";
        }
        request.setAttribute("imageroot", imageroot);
        request.setAttribute("imagecoverroot", imagecoverroot);
        request.setAttribute("videoroot", videoroot);
        request.setAttribute("power", power);
        return "index";
    }

}
